package com.ybkj.o2o.mc.common.query;

import org.apache.commons.lang.StringUtils;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;

/**
 * Created by shine on 16/9/19.
 */
public class PassengerQuery2 implements Serializable {
	
  private String[] passengerIds;

  private Integer[] type;

  private Long[] gradeId;

  private Long companyId;

  private Long[] companyIds;

  private Boolean[] permission;
  
  private Integer[] isPlatform;//是否上传监管平台（查询条件）

  private String[] channelName;

  private Date startTime;

  private Date endTime;

  private Long enterpriseId;
  
  private Long departmentId;

  private String departmentName;
  
  private String enterpriseName;
  
  private String jobNumber;

  private String name;

  private String phone;

  private String carNumber;

  private String appKey;

  private Integer page;

  private Integer rows;

  private Integer offset;
  
  private String serviceType;
  
  private Date serviceTime;

  private String[] introducer;

  public String[] getIntroducer() {
    return introducer;
  }

  public void setIntroducer(String[] introducer) {
    this.introducer = introducer;
  }

  public Integer[] getIsPlatform() {
	return isPlatform;
}

public void setIsPlatform(Integer[] isPlatform) {
	this.isPlatform = isPlatform;
}

public Integer[] getType() {
    return type;
  }

  public void setType(Integer[] type) {
    this.type = type;
  }

  public Long[] getGradeId() {
    return gradeId;
  }

  public void setGradeId(Long[] gradeId) {
    this.gradeId = gradeId;
  }

  public Long getCompanyId() {
    return companyId;
  }

  public void setCompanyId(Long companyId) {
    this.companyId = companyId;
  }

  public Long[] getCompanyIds() {
    return companyIds;
  }

  public void setCompanyIds(Long[] companyIds) {
    this.companyIds = companyIds;
  }

  public Boolean[] getPermission() {
    return permission;
  }

  public void setPermission(Boolean[] permission) {
    this.permission = permission;
  }

  public String[] getChannelName() {
    return channelName;
  }

  public void setChannelName(String[] channelName) {
    this.channelName = channelName;
  }

  public Date getStartTime() {
    return startTime;
  }

  /**
   * 把long转换为date类型.
   */
  public void setStartTime(Long start) {
    if (null != start) {
      this.startTime = new Date(start);
    }

  }

  public Date getEndTime() {
    return endTime;
  }

  /**
   * 把long转换为date类型.
   */
  public void setEndTime(Long end) {
    if (null != end) {
      this.endTime = new Date(end);
    }
  }

  public String getName() {

    return name;
  }

  /**
   * 普通字符串转换为数据库模糊查询的字符串，即两边连接'%'.
   */
  public void setName(String name) {
    if (StringUtils.isNotBlank(name)) {
      this.name = "%" + name + "%";
    } else {
      this.name = null;
    }
  }

  public String getPhone() {

    return phone;
  }

  /**
   * 普通字符串转换为数据库模糊查询的字符串，即两边连接'%'.
   */
  public void setPhone(String phone) {
    if (StringUtils.isNotBlank(phone)) {
      this.phone = "%" + phone + "%";
    } else {
      this.phone = null;
    }
  }

  public String getCarNumber() {

    return carNumber;
  }

  /**
   * 普通字符串转换为数据库模糊查询的字符串，即两边连接'%'.
   */
  public void setCarNumber(String carNumber) {
    if (StringUtils.isNotBlank(carNumber)) {
      this.carNumber = "%" + carNumber + "%";
    } else {
      this.carNumber = null;
    }
  }

  public String getAppKey() {
    return appKey;
  }

  public void setAppKey(String appKey) {
    this.appKey = appKey;
  }

  public Integer getPage() {
    return page;
  }

  public void setPage(Integer page) {
    this.page = page;
  }

  public Integer getRows() {
    return rows;

  }

  public void setRows(Integer rows) {
    this.rows = rows;
  }

  /**
   * 根据page和rows计算出偏移量.
   */
  public Integer getOffset() {
    if (getPage() == null || getRows() == null) {
      return null;
    }
    if (getPage() > 0) {
      return (getPage() - 1) * getRows();
    }
    return offset;
  }

  public void setOffset(Integer offset) {
    this.offset = offset;
  }

  public Long getEnterpriseId() {
    return enterpriseId;
  }

  public void setEnterpriseId(Long enterpriseId) {
    this.enterpriseId = enterpriseId;
  }

  public Long getDepartmentId() {
    return departmentId;
  }

  public void setDepartmentId(Long departmentId) {
    this.departmentId = departmentId;
  }

  public String getDepartmentName() {
    return departmentName;
  }

  public void setDepartmentName(String departmentName) {
    if (StringUtils.isNotBlank(departmentName)) {
      this.departmentName = "%" + departmentName + "%";
    } else {
      this.departmentName = null;
    };
  }

  @Override
  public String toString() {
    return "PassengerQuery2{" +
            "passengerIds=" + Arrays.toString(passengerIds) +
            ", type=" + Arrays.toString(type) +
            ", gradeId=" + Arrays.toString(gradeId) +
            ", companyId=" + companyId +
            ", companyIds=" + Arrays.toString(companyIds) +
            ", permission=" + Arrays.toString(permission) +
            ", isPlatform=" + Arrays.toString(isPlatform) +
            ", channelName=" + Arrays.toString(channelName) +
            ", startTime=" + startTime +
            ", endTime=" + endTime +
            ", enterpriseId=" + enterpriseId +
            ", departmentId=" + departmentId +
            ", departmentName='" + departmentName + '\'' +
            ", enterpriseName='" + enterpriseName + '\'' +
            ", jobNumber='" + jobNumber + '\'' +
            ", name='" + name + '\'' +
            ", phone='" + phone + '\'' +
            ", carNumber='" + carNumber + '\'' +
            ", appKey='" + appKey + '\'' +
            ", page=" + page +
            ", rows=" + rows +
            ", offset=" + offset +
            ", serviceType='" + serviceType + '\'' +
            ", serviceTime=" + serviceTime +
            ", introducer='" + introducer + '\'' +
            '}';
  }

  public String getEnterpriseName() {
	return enterpriseName;
}

public void setEnterpriseName(String enterpriseName) {
	if (StringUtils.isNotBlank(enterpriseName)) {
      this.enterpriseName = "%" + enterpriseName + "%";
    } else {
      this.enterpriseName = null;
    };
}

public String getJobNumber() {
	return jobNumber;
}

public void setJobNumber(String jobNumber) {
	if (StringUtils.isNotBlank(jobNumber)) {
      this.jobNumber = "%" + jobNumber + "%";
    } else {
      this.jobNumber = null;
    };
}

public String[] getPassengerIds() {
	return passengerIds;
}

public void setPassengerIds(String[] passengerIds) {
	this.passengerIds = passengerIds;
}

public String getServiceType() {
	return serviceType;
}

public void setServiceType(String serviceType) {
	this.serviceType = serviceType;
}

public Date getServiceTime() {
	return serviceTime;
}

public void setServiceTime(Date serviceTime) {
	this.serviceTime = serviceTime;
} 
}
